using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop.Member;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class Member_Index : Member, IRequiresSessionState
{
	public string m_mainUrl = "";
	public int m_shopid = 0;
	protected HyperLink RepairMyShop;
	protected HyperLink goMyShop;
	protected Literal LinkMainUrl;
	protected HiddenField ExistShop;
	protected HtmlForm form_1;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Init(object sender, EventArgs e)
	{
		try
		{
			Template.BindTemplateToPage(this.Page, "MemberIndex");
			this.ShowBuyerSaler();
			this.ShowPreView();
		}
		catch (Exception ex)
		{
			base.WriteTemErrMsg(ex.Message.ToString());
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		bool visible = true;
		this.m_shopid = base.user.ShopID;
		Control control = this.Page.FindControl("Lmyshop");
		if (this.m_shopid > 0)
		{
			visible = false;
			this.goMyShop.Visible = true;
			this.ExistShop.Value = "1";
			this.goMyShop.NavigateUrl = string.Concat(new object[]
			{
				"../Store/ShopIndex.aspx?ShopID=",
				this.m_shopid.ToString(),
				"&SalerID=",
				base.user.UserID
			});
			this.RepairMyShop.NavigateUrl = string.Concat(new object[]
			{
				"../Store/ShopEdit.aspx?ShopID=",
				this.m_shopid.ToString(),
				"&SalerID=",
				base.user.UserID
			});
			this.RepairMyShop.Visible = true;
			control.Visible = true;
		}
		else
		{
			control.Visible = false;
		}
		HtmlGenericControl htmlGenericControl = (HtmlGenericControl)this.Page.FindControl("OpenShop");
		if (htmlGenericControl != null)
		{
			htmlGenericControl.Visible = visible;
		}
		if (this.ShowBuyerSaler() && this.m_shopid > 0)
		{
			HtmlGenericControl htmlGenericControl2 = (HtmlGenericControl)this.Page.FindControl("Lmyshop");
			if (htmlGenericControl2 != null)
			{
				htmlGenericControl2.Visible = true;
			}
		}
		if (string.Empty != Fetch.Get("mainurl"))
		{
			string text = this.Page.Request.Url.ToString().ToLower();
			int num = text.LastIndexOf("mainurl");
			string mainUrl = text.Substring(num + 8);
			this.m_mainUrl = mainUrl;
		}
	}
	protected bool ShowBuyerSaler()
	{
		string groupPower = base.user.GetGroupPower("GroupPower");
		if (!groupPower.Contains("showbuy"))
		{
			this.Page.FindControl("Lbuyer").Visible = false;
		}
		if (!groupPower.Contains("showsaler") || !groupPower.Contains("useclientrelation"))
		{
			this.Page.FindControl("LClientRelation").Visible = false;
		}
		Control control = this.Page.FindControl("Lmyshop");
		if (!groupPower.Contains("allowopenshop"))
		{
			control.Visible = false;
		}
		if (StaticFunApp.ShopConfig["ShowScore"].IsNull(new object[0]) == "1")
		{
			this.Page.FindControl("L_a_PresentExp").Visible = true;
		}
		if (!groupPower.Contains("showsaler"))
		{
			this.Page.FindControl("Lsaler").Visible = false;
			this.Page.FindControl("Lmanageshop").Visible = false;
			control.Visible = false;
		}
		if (!groupPower.Contains("stockmanage"))
		{
			this.Page.FindControl("LStock").Visible = false;
		}
		if (groupPower.Contains("promotionmanage"))
		{
			if (StaticFunApp.ShopConfig["ShowScore"].IsNull(new object[0]) == "1")
			{
			}
			if (this.Page.FindControl("LPromotion_ProductScore") != null)
			{
				this.Page.FindControl("LPromotion_ProductScore").Visible = true;
			}
			if (this.Page.FindControl("LPromotion_ProductPromotion") != null)
			{
				this.Page.FindControl("LPromotion_ProductPromotion").Visible = true;
			}
			if (this.Page.FindControl("LPromotion_ManageOrder") != null)
			{
				this.Page.FindControl("LPromotion_ManageOrder").Visible = true;
			}
			if (this.Page.FindControl("LPromotion_SaleView") != null)
			{
				this.Page.FindControl("LPromotion_SaleView").Visible = true;
			}
			if (this.Page.FindControl("LPromotion_SaleOrderView") != null)
			{
				this.Page.FindControl("LPromotion_SaleOrderView").Visible = true;
			}
		}
		if (!groupPower.Contains("financemanage"))
		{
			this.Page.FindControl("LFinance").Visible = false;
		}
		return false;
	}
	public void ShowPreView()
	{
		if (base.user.UserName == "游客")
		{
			Control control = this.Page.FindControl("Lsaler");
			Control control2 = this.Page.FindControl("Lmyshop");
			Control control3 = this.Page.FindControl("Lmanageshop");
			Control control4 = this.Page.FindControl("LManagecredit");
			control.Visible = false;
			control2.Visible = false;
			control3.Visible = false;
			control4.Visible = false;
		}
	}
}
